package Thread;

public class Test03_Thread03 {
    public static void main(String[] args) {
        MyThread03 t = new MyThread03();
        new Thread(t,"线程一").start();
        new Thread(t,"线程二").start();
        new Thread(t,"线程三").start();

    }
}

class MyThread03 implements Runnable{

    Object lock = new Object();


    @Override
    public void run() {
        synchronized (lock){
            System.out.print(Thread.currentThread().getName()+":");
            for(int i = 0;i<=10;i++){
                System.out.print(i);
                if (i<10){
                    System.out.print(",");
                }
            }
            System.out.println();
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }



    }
}
